<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of pegawai
 *
 * @author user
 */
class Db_pegawai extends Model{
    //put your code here
    function Db_pegawai(){
        parent::Model();
    }

    function retr_list_nama(){
        $names = $this->db->query("SELECT * FROM pegawai WHERE role !='admin'");
        $i = 0;
        foreach ($names->result() as $nama){
            $res[$i] = $nama;
            $i++;
        }

        return $res;
    }

    function change_role($n, $r){
        $this->db->query("UPDATE pegawai SET role='$r' WHERE nama='$n'");
    }
}
?>
